#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

void matrix_multiply(int* m1, int* m2, int* r, int x, int y, int z)
{
	int i = 0;
	int j = 0;
	int k = 0;
	for (i = 0; i < x; i++)
	{
		for (j = 0; j < z; j++)
		{
			int aij = 0;
			int c = 0;
			for (c = 0; c < y; c++)
			{
				aij += (*(m1 + i * y + c)) * (*(m2 + c * z + j));
			}
			*(r + z * i + j) = aij;
		}
	}	
}

int main()
{
	int A[3][2] = { {2,-6},{3,5},{1,-1} };
	int B[2][4] = { {4,-2,-4,-5},{-7,-3,6,7} };
	int R[3][4] = { 0 };
	matrix_multiply((int*)&A[0][0], (int*)&B[0][0], (int*)&R[0][0], 3, 2, 4);
	return 0;
}